package Java9_2.Test_2;

import java.util.Scanner;

public class Jisuan {
    private int a;//总课时
    private int b;//课程数

    public Jisuan(int a, int b)throws Exception {
        setA(a);
        this.b = b;
    }

    public int getA() {
        return a;
    }

    public void setA(int a)throws Exception{
        if (a<100){
            Exception e=new Exception("课时少于100，课时太少");
            throw e;
        }else {
            this.a = a;
        }
    }

    public int getB() {
        return b;
    }

    public void setB(int b) {
        this.b = b;
    }

    public void avg(){
        int avg=a/b;
        System.out.println("平均课时是"+avg);

        }
    }


